package com.fucius.study.leetcode;

import java.util.Arrays;

public class EliminateMaximum {


    public int eliminateMaximum(int[] dist, int[] speed) {
        int[] time = new int[dist.length];
        for (int i = 0; i < dist.length; i++) {
            time[i] = (dist[i]-1)/speed[i];
        }
        Arrays.sort(time);

        for (int i = 0; i < time.length; ++i){
            if (time[i] < i){
                return i;
            }
        }
        return time.length;
    }

    public static void main(String[] args) {
        int[] dist = {3,2,4};
        int[] speed = {5,3,2};
        System.out.println(new EliminateMaximum().eliminateMaximum(dist,speed));
    }
}
